﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using LogManager.Base;
using LogManager.Base.Data;
using LogManager.Config.Data;

namespace LogManager.Config
{
    public class LogTypeConfiguration : ConfigurationElement, ILogType
    {
        /// <summary>
        /// Type Id of the event type (e.g. 1309)
        /// </summary>
        [ConfigurationProperty("typeId", IsKey = true)]
        public string TypeId
        {
            get { return (string)this["typeId"]; }
            set { this["typeId"] = value; }
        }

        /// <summary>
        /// Associated c# type name for this id.
        /// </summary>
        [ConfigurationProperty("type")]
        public string TypeName
        {
            get { return (string)this["type"]; }
            set { this["type"] = value; }
        }

        [ConfigurationProperty("defaultView")]
        public string DefaultView
        {
            get { return (string) this["defaultView"]; }
            set { this["defaultView"] = value; }
        }

        public Type Type
        {
            get { return System.Type.GetType(TypeName); }
        }
    }
}
